package com.asfusion.mate.actions.builders
{
	import com.asfusion.mate.actions.IAction;
	
	import mx.messaging.ChannelSet;
	import mx.rpc.AsyncToken;

	public class ChannelSetLogoutInvoker extends ChannelSetInvoker implements IAction
	{
		
		/*-.........................................invoke..........................................*/
		/**
		 * @inheritDoc
		 */
		override protected function invoke( channelSet:ChannelSet ):AsyncToken
		{
			var localToken:AsyncToken;
			
			if( channelSet.authenticated )
			{
				localToken = channelSet.logout();
			} else {
				throw( new Error( "ChannelSet is not authenticated." ) );
			}
			
			return localToken;
		}
		
	}
}